﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace HealthMonitoring
{
    
        public sealed class MemoryDumpDiagnosticsSection : ConfigurationSection
        {
            /// <summary>
            /// This property defines if MDD is enabled or not
            /// </summary>
            [ConfigurationProperty("enabled", IsRequired = true, DefaultValue = false)]
            public bool Enabled
            {
                get { return Convert.ToBoolean(this["enabled"]); }
                set { this["enabled"] = value; }
            }

            /// <summary>
            /// This property defines if new thread should be created for writing mini memory dump or not
            /// </summary>
            [ConfigurationProperty("spawnNewThread", IsRequired = false, DefaultValue = false)]
            public bool SpawnNewThread
            {
                get { return Convert.ToBoolean(this["spawnNewThread"]); }
                set { this["spawnNewThread"] = value; }
            }

            /// <summary>
            /// This property defines the path where th mini memory dump file should be saved
            /// </summary>
            [ConfigurationProperty("path", IsRequired = true)]
            public string Path
            {
                get { return (string)this["path"]; }
                set { this["path"] = value; }
            }

            /// <summary>
            /// This property defines the type of mini memory dump
            /// </summary>
            [ConfigurationProperty("miniDumpType", IsRequired = false, DefaultValue = MiniDumpType.MiniDumpWithFullMemory)]
            public MiniDumpType MiniDumpType
            {
                get { return (MiniDumpType)this["miniDumpType"]; }
                set { this["miniDumpType"] = value; }

            }

            /// <summary>
            /// This property defines the event code off set value
            /// </summary>
            [ConfigurationProperty("eventCodeOffSet", IsRequired = false, DefaultValue = MemoryDumpManager.Constants.DefaultOffSetCode)]
            public int EventCodeOffSet
            {
                get { return Convert.ToInt32(this["eventCodeOffSet"]); }
                set { this["eventCodeOffSet"] = value; }
            }


            /// <summary>
            /// This property defines the exceptionType value
            /// </summary>
            [ConfigurationProperty("exceptionType", IsRequired = false)]
            public string ExceptionType
            {
                get { return this["exceptionType"].ToString(); }
                set { this["exceptionType"] = value; }
            }
        }
    }


  